package com.zc.im.controller;

import com.zc.im.model.user.UserImModel;
import com.zc.im.model.user.ZcUser;
import com.zc.im.service.user.UserService;
import com.zc.im.util.ResponseJson;
import com.zc.im.util.login.UserSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 用户处理controller
 * Created by wangcc on 2017/7/8.
 */
@Controller
@RequestMapping("/user")
public class ZcUserController extends UserSession {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/getUser",method = RequestMethod.GET)
    @ResponseBody
    public ResponseJson getUser(String uId, HttpServletRequest request){
        ZcUser sessionUser = getSession(request);
        if (uId == null) {
            return null;
        }
        ZcUser zcUser= userService.queryUser(Integer.parseInt(uId));
         System.out.print(zcUser);
        return null;
    }
}
